package com.sylli.oeuf.server.object.transferable;

import com.sylli.oeuf.server.game.logic.invocation.AndInvocationCondition;
import com.sylli.oeuf.server.game.logic.invocation.DispatcherEntry;
import com.sylli.oeuf.server.game.logic.invocation.InvocationEntry;
import com.sylli.oeuf.server.game.logic.invocation.InvocationEvent;
import com.sylli.oeuf.server.game.logic.invocation.LogicObjectFactory;
import com.sylli.oeuf.server.game.logic.invocation.InvocationParameter;

public class StrategyEntryTO extends BasedTO {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2397369827369139333L;

	private String skillName;
	
	private int priority;
	
	private int rank;
	
	private String condition;
	
	private String conditionValue;
	
	private String target;
	
	public DispatcherEntry toGameLogicObject() {
		DispatcherEntry entry = new DispatcherEntry();
		
		InvocationParameter ip = new InvocationParameter(rank, priority, LogicObjectFactory.getCastingTarget(target));
		entry.setParams(ip);
		InvocationEntry en = LogicObjectFactory.createSkillByName(skillName).getInvocationEntryOn(InvocationEvent.STD_IE_ON_ACTIVE);
		entry.setAction(en.getAction());
		entry.setCondition(new AndInvocationCondition(
				LogicObjectFactory.createCondition(condition, conditionValue),
				en.getCondition()));
		return entry;
	}
	
	public StrategyEntryTO() {
		// for flex
	}
	
	public StrategyEntryTO(String skillName, int priority, int rank, String condition, String conditionValue) {
		this.skillName = skillName;
		this.priority = priority;
		this.rank = rank;
		this.condition = condition;
		this.conditionValue = conditionValue;
	}

	public String getSkillName() {
		return skillName;
	}

	public void setSkillName(String skillName) {
		this.skillName = skillName;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public String getConditionValue() {
		return conditionValue;
	}

	public void setConditionValue(String conditionValue) {
		this.conditionValue = conditionValue;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}
	
}
